#include "../Basics/BasicStruct.cpp"
queue<int> Q;
bool visited[5]={true};
int v;

// 广度优先遍历图
void BFS(Graph g,int v0) {
    initQueue(Q);

    visit(v0);
    visited[v0] = true;
    enterQueue(Q, v0);

    while (!EmptyQueue(Q)) {
        deleteQueue(Q,&v);
        ArcNode* w = g->vertex[v]->firstArc;
        while(w != NULL) {
            if (!visited[w->adj]) {
                visit(w->adj);
                visited[w->adj]= true;
                enterQueue(Q,w->adj);
            }
            w = w->next;
        }
    }
}

int main() {
    Graph g = CreateGraph();
    BFS(g,2);
}